**************************************************************************************************
*** This do file creates the replication results for 
*** Health Spending, Out-of-Pocket Contributions, and Mortality Rates	 					 	*/
*** Thomas Pluemper (University of Essex)														*/
*** Eric Neumayer (LSE)																			*/
*** 																							*/
*** Published in: Public Administration, 91 (2), 2013, pp. 403-418												*/
**************************************************************************************************
**************************************************************************************************
/* Note: 
You have to change "local DIR" to the directory you copy the original stata files contained 	*/
/* in the zip file and then run the do file. 													*/
**************************************************************************************************

version 12.0
drop _all
clear matrix
clear mata
set mem 800m
set mat 5000

capture net install outreg2, from(http://fmwww.bc.edu/RePEc/bocode/o)			/* checks whether outreg2 is installed 		*/

***********************************************************************************
local DIR = "C:\Research\Health for all database\WHO mortality database\"  /*change relative path to the directory where the files are located */
cd "`DIR'"
***********************************************************************************

use "Article for Public Administration (mortality).dta", clear

tsset countryid year

* Sample descriptive statistics
xi: quietly xtreg   allcause  l.allcause    total_exp_gdp   outofpocket_totot   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year if year>=1984 & oecd==1, fe robust
su allcause if e(sample)
list country year allcause if allcause==r(min) & e(sample)
list country year allcause if allcause==r(max) & e(sample)

su public_exp_totexp if e(sample)
list country year public_exp_totexp if public_exp_totexp==r(min) & e(sample)
list country year public_exp_totexp if public_exp_totexp==r(max) & e(sample)

su total_exp_pc if e(sample)
list country year total_exp_pc if total_exp_pc==r(min) & e(sample)
list country year total_exp_pc if total_exp_pc==r(max) & e(sample)

su total_exp_gdp if e(sample)
list country year total_exp_gdp if total_exp_gdp==r(min) & e(sample)
list country year total_exp_gdp if total_exp_gdp==r(max) & e(sample)

su outofpocket_totot if e(sample)
list country year outofpocket_totot if outofpocket_totot==r(min) & e(sample)
list country year outofpocket_totot if outofpocket_totot==r(max) & e(sample)



* Create mean-centered variables for interaction effect
capture drop total_exp_pc_meancent
capture drop total_exp_gdp_meancent
capture drop outofpocket_totot_meancent
quietly su total_exp_pc if e(sample)
gen total_exp_pc_meancent=total_exp_pc-r(mean)
quietly su total_exp_gdp if e(sample)
gen total_exp_gdp_meancent=total_exp_gdp-r(mean)
quietly su outofpocket_totot if e(sample)
gen outofpocket_totot_meancent=outofpocket_totot-r(mean)

* Table 1
xi: xtreg   allcause  l.allcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
outreg2 using c:\table1, replace excel

xi: xtreg   allcause  l.allcause c.total_exp_pc_meancent#c.outofpocket_totot_meancent    total_exp_pc_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
outreg2 using c:\table1, append excel 

* Table 2
* Include fertility rate and share of elderly among population
xi: xtreg   allcause  l.allcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq    fertilityrate_interpol popab64share i.year  if year>=1984 & oecd==1, fe robust
outreg2 using c:\table2, replace excel 

* Include unemployment rate
xi: xtreg   allcause  l.allcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq unemploy_share_labforc   i.year  if year>=1984 & oecd==1, fe robust
outreg2 using c:\table2, append excel 

* Include unemployment rate & behavioral variables
xi: xtreg   allcause  l.allcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq unemploy_share_labforc  alcoholpc_inter fat_pc  i.year  if year>=1984 & oecd==1, fe robust
outreg2 using c:\table2, append excel 

* Weigthing observations by country's population size
xi: xtreg   allcause  l.allcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1 [weight=pop_period_average], fe robust
outreg2 using c:\table2, append excel 

* Excluding United States & Luxembourg
xi: xtreg   allcause  l.allcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1 & country!="United States" & country!="Luxembourg", fe robust
outreg2 using c:\table2, append excel 

* Excluding external causes
xi: xtreg   allcause_minus_external   l.allcause_minus_external  c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
outreg2 using c:\table2, append excel 

** Selected substantive effects reported in text
capture drop lallcause
gen lallcause=l.allcause

* Compute substantive effect of public expenditure share
xi: xtreg   allcause  lallcause c.total_exp_gdp_meancent#c.outofpocket_totot_meancent    total_exp_gdp_meancent   outofpocket_totot_meancent   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
capture drop LDV
gen LDV=_b[lallcause]
margins, at(public_exp_totexp=(1 2)) post
di "Short-term effect is:"
nlcom (_b[2._at]-_b[1._at]), level(90)
di "Long-term effect is:"
nlcom (_b[2._at]-_b[1._at])/(1-LDV), level(90)


* Compute effect for Australia (1988: total_exp_gdp=6.5, OOP=14.8; 1996: total_exp_gdp=7.6, OOP=17)
quietly xi: xtreg   allcause  lallcause c.total_exp_gdp#c.outofpocket_totot    total_exp_gdp   outofpocket_totot   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
capture drop LDV
gen LDV=_b[lallcause]
margins, at(total_exp_gdp=(6.5 7.6) outofpocket_totot=(14.8 17)) post
di "Short-term effect is:"
nlcom (_b[4._at]-_b[1._at]), level(90)
di "Long-term effect is:"
nlcom (_b[4._at]-_b[1._at])/(1-LDV), level(90)

* What increase in total_exp_gdp alone would create similar effect?
quietly xi: xtreg   allcause  lallcause c.total_exp_gdp#c.outofpocket_totot    total_exp_gdp   outofpocket_totot   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
* Answer: roughly increasing total_exp_gdp by 3 percentage points
margins, at(total_exp_gdp=(6.5 9.5) outofpocket_totot=(14.8)) post
di "Short-term effect is: "
nlcom (_b[2._at]-_b[1._at]), level(90)


* Compute effect for Finland (1991: total_exp_gdp=8.8, OOP=15.6; 1995: total_exp_gdp=7.9, OOP=21.8)
quietly xi: xtreg   allcause  lallcause c.total_exp_gdp#c.outofpocket_totot    total_exp_gdp   outofpocket_totot   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
capture drop LDV
gen LDV=_b[lallcause]
margins, at(total_exp_gdp=(8.8 7.9) outofpocket_totot=(15.6 21.8)) post
di "Short-term effect is:"
nlcom (_b[4._at]-_b[1._at]), level(90)
di "Long-term effect is:"
nlcom (_b[4._at]-_b[1._at])/(1-LDV), level(90)


* Compute effect for Italy (1991: total_exp_gdp=7.9, OOP=17.2; 1995: total_exp_gdp=7.3, OOP=26.6)
quietly xi: xtreg   allcause  lallcause c.total_exp_gdp#c.outofpocket_totot    total_exp_gdp   outofpocket_totot   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
capture drop LDV
gen LDV=_b[lallcause]
margins, at(total_exp_gdp=(7.9 7.3) outofpocket_totot=(17.2 26.6)) post
di "Short-term effect is:"
nlcom (_b[4._at]-_b[1._at]), level(90)
di "Long-term effect is:"
nlcom (_b[4._at]-_b[1._at])/(1-LDV), level(90)

* Compute effect for Italy (1995: total_exp_gdp=7.3, OOP=26.9; 2003: total_exp_gdp=8.3, OOP=22.4)
quietly xi: xtreg   allcause  lallcause c.total_exp_gdp#c.outofpocket_totot    total_exp_gdp   outofpocket_totot   public_exp_totexp     lngdppc_ppp lngdppc_ppp_sq   i.year  if year>=1984 & oecd==1, fe robust
capture drop LDV
gen LDV=_b[lallcause]
margins, at(total_exp_gdp=(7.3 8.3) outofpocket_totot=(26.6 22.4)) post
di "Short-term effect is:"
nlcom (_b[4._at]-_b[1._at]), level(90)
di "Long-term effect is:"
nlcom (_b[4._at]-_b[1._at])/(1-LDV), level(90)

